<!DOCTYPE html>
<html>
<head>
    <title></title>
    <#include "/header.html">
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
            <#if shiro.hasPermission("message:message:save")>
            <a class="btn btn-primary" @click="addMessage"><i class="fa fa-plus"></i>&nbsp;新增消息</a>
            </#if>
            <#if shiro.hasPermission("message:message:save")>
            <a class="btn btn-primary" @click="addPushAll"><i class="fa fa-plus"></i>&nbsp;推送全部设备</a>
            </#if>
            <#if shiro.hasPermission("message:message:update")>
            <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
            </#if>
            <#if shiro.hasPermission("message:message:delete")>
            <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
            </#if>
        </div>
        <div class="form-group">
            <div class="form-group col-sm-2">
                <select class="form-control" v-model="q.messageType" @keyup.enter="query">
                    <option disabled value="">请选择消息类型</option>
                    <option value="0">普通消息</option>
                    <option value="1">推送单条消息</option>
                    <option value="2">推送全部设备</option>
                </select>
            </div>
            <div class="form-group col-sm-2">
                <input type="text" class="form-control" v-model="q.username" @keyup.enter="query" placeholder="用户名">
            </div>
            <a class="btn btn-default" @click="query">查询</a>
        </div>
<table id="jqGrid"></table>
<div id="jqGridPager"></div>
</div>

<!--新增消息/修改普通、推送单条消息-->
<div v-show="addMessageView" class="panel panel-default" align="center">
    <div class="panel-heading">{{title}}</div>
    <form class="form-horizontal" style="width:90%!important;">
        <div class="form-group">
            <div class="col-sm-2 control-label" style="width: 10%;">类型</div>
            <div class="col-sm-10" style="width: 40%;">
                <select class="form-control" v-model="message.type">
                    <option disabled value="">请选择消息类型</option>
                    <option value="0">普通消息</option>
                    <option value="1">推送单条消息</option>
                    <option disabled value="2">推送全部设备</option>
                </select>
            </div>
            <div class="col-sm-2 control-label" style="width: 10%;">用户名</div>
            <div class="col-sm-10" style="width: 40%;">
                <input type="text" class="form-control" width="80%" v-model="message.username" placeholder=""/>
            </div>

        </div>

        <div class="form-group">
            <div class="col-sm-2 control-label" style="width: 10%;">标题</div>
            <div class="col-sm-10" style="width: 40%;">
                <input type="text" class="form-control" width="80%" v-model="message.title" placeholder=""/>
            </div>

            <div class="col-sm-2 control-label" style="width: 10%;">消息内容</div>
            <div class="col-sm-10" style="width: 40%;">
                <input type="text" class="form-control" width="80%" v-model="message.message" placeholder=""/>
            </div>
        </div>

        <div id="readstateUpdate" class="form-group">
            <div class="col-sm-2 control-label" style="width: 10%;">读取状态</div>
            <div class="col-sm-10" style="width: 40%;">
                <select class="form-control" v-model="message.readstate">
                    <option disabled value="">请选择读取状态</option>
                    <option value="0">未读</option>
                    <option value="1">已读</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label"></div>
            <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
            &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
        </div>
    </form>
</div>


<!--修改消息-->
<div v-show="updateView" class="panel panel-default" align="center">
    <div class="panel-heading">{{title}}</div>
    <form class="form-horizontal" style="width:90%!important;">
        <div class="form-group">
            <div class="col-sm-2 control-label" style="width: 10%;">类型</div>
            <div class="col-sm-10" style="width: 40%;">
                <select class="form-control">
                    <option id="selectedType"></option>
                </select>
            </div>
            <div class="col-sm-2 control-label" style="width: 10%;">用户名</div>
            <div class="col-sm-10" style="width: 40%;">
                <input type="text" class="form-control" width="80%" v-model="message.username" placeholder="用户名"/>
            </div>

        </div>

        <div class="form-group">
            <div class="col-sm-2 control-label" style="width: 10%;">标题</div>
            <div class="col-sm-10" style="width: 40%;">
                <input type="text" class="form-control" width="80%" v-model="message.title" placeholder=""/>
            </div>

            <div class="col-sm-2 control-label" style="width: 10%;">消息内容</div>
            <div class="col-sm-10" style="width: 40%;">
                <input type="text" class="form-control" width="80%" v-model="message.message" placeholder=""/>
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-2 control-label" style="width: 10%;">读取状态</div>
            <div class="col-sm-10" style="width: 40%;">
                <select class="form-control" v-model="message.readstate">
                    <option disabled value="">请选择读取状态</option>
                    <option value="0">未读</option>
                    <option value="1">已读</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label"></div>
            <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
            &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
        </div>
    </form>
</div>

<!--新增全部推送-->
<div v-show="addPushAllView" class="panel panel-default" align="center">
    <div class="panel-heading">{{title}}</div>
    <form class="form-horizontal" style="width:90%!important;">
        <div class="form-group">
            <div class="col-sm-2 control-label" style="width: 10%;">类型</div>
            <div class="col-sm-10" style="width: 40%;">
                <select class="form-control" v-model="message.type">
                    <option disabled value="">请选择消息类型</option>
                    <option disabled value="0">普通消息</option>
                    <option disabled value="1">推送单条消息</option>
                    <option value="2">推送全部设备</option>
                    <!--<option disabled value="3">普通消息Excel导入</option>-->
                </select>
            </div>

            <div class="col-sm-2 control-label" style="width: 10%;">标题</div>
            <div class="col-sm-10" style="width: 40%;">
                <input type="text" class="form-control" width="80%" v-model="message.title" placeholder=""/>
            </div>

        </div>

        <div class="form-group">
            <div class="col-sm-2 control-label" style="width: 10%;">消息内容</div>
            <div class="col-sm-10" style="width: 90%;">
                <input type="text" class="form-control" width="80%" v-model="message.message" placeholder=""/>
            </div>
        </div>

        <div id="readstateUpdate2" class="form-group">
            <div class="col-sm-2 control-label" style="width: 10%;">读取状态</div>
            <div class="col-sm-10" style="width: 40%;">
                <select class="form-control" v-model="message.readstate">
                    <option disabled value="">请选择读取状态</option>
                    <option value="0">未读</option>
                    <option value="1">已读</option>
                </select>
            </div>
        </div>

        <!--<div class="form-group">-->
        <!--<div class="col-sm-2 control-label" style="width: 10%;"></div>-->
        <!--<div class="col-sm-10" style="width: 40%;">-->
        <!--<input type="text" class="form-control" width="80%" v-model="message.readstate" placeholder=""/>-->
        <!--</div>-->
        <!--</div>-->
        <div class="form-group">
            <div class="col-sm-2 control-label"></div>
            <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
            &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
        </div>
    </form>
</div>




</div>

<script src="${request.contextPath}/statics/js/modules/message/message.js?_${.now?long}"></script>
</body>
</html>
